<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>选择身份</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        body { background: #f8f9fa; }
        .role-card { cursor: pointer; transition: transform .2s; }
        .role-card:hover { transform: translateY(-4px); }
        .active-role { border: 2px solid #667eea; }
    </style>
    <script>
        function selectRole(role){
            document.getElementById('role').value = role;
            const cards = document.querySelectorAll('.role-card');
            cards.forEach(c=>c.classList.remove('active-role'));
            document.getElementById('card-'+role).classList.add('active-role');
        }
    </script>
    </head>
<body>
    <div class="container py-5">
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <div class="card">
                    <div class="card-header">
                        <h5 class="mb-0"><i class="fas fa-user-shield"></i> 请选择本次使用的身份并进行二次验证</h5>
                    </div>
                    <div class="card-body">
                        {% with messages = get_flashed_messages() %}
                            {% if messages %}
                                {% for message in messages %}
                                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                                        {{ message }}
                                        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                                    </div>
                                {% endfor %}
                            {% endif %}
                        {% endwith %}

                        <div class="row g-3 mb-3">
                            <div class="col-6 col-md-3">
                                <div id="card-recon" class="card role-card" onclick="selectRole('recon')">
                                    <div class="card-body text-center">
                                        <div class="text-success fs-3"><i class="fas fa-search"></i></div>
                                        <div class="mt-2">侦察员</div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-6 col-md-3">
                                <div id="card-analyst" class="card role-card" onclick="selectRole('analyst')">
                                    <div class="card-body text-center">
                                        <div class="text-info fs-3"><i class="fas fa-chart-line"></i></div>
                                        <div class="mt-2">分析员</div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-6 col-md-3">
                                <div id="card-decision" class="card role-card" onclick="selectRole('decision')">
                                    <div class="card-body text-center">
                                        <div class="text-warning fs-3"><i class="fas fa-gavel"></i></div>
                                        <div class="mt-2">决策员</div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-6 col-md-3">
                                <div id="card-executor" class="card role-card" onclick="selectRole('executor')">
                                    <div class="card-body text-center">
                                        <div class="text-danger fs-3"><i class="fas fa-cogs"></i></div>
                                        <div class="mt-2">执行员</div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <form method="POST">
                            <input type="hidden" id="role" name="role" value="{{ active_role or '' }}">
                            <div class="mb-3">
                                <label class="form-label">身份密码（再次输入账号密码以验证）</label>
                                <input type="password" name="role_password" class="form-control" placeholder="请输入密码" required>
                            </div>
                            <button class="btn btn-primary" type="submit"><i class="fas fa-check"></i> 启用身份</button>
                            <a href="{{ url_for('logout') }}" class="btn btn-link">退出账户</a>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>


